﻿<%@ Page Title="User Settings" Language="C#" MasterPageFile="~/Backoffice/BackOffice.Master"
    AutoEventWireup="true" CodeBehind="UserSettings.aspx.cs" Inherits="TreaShares.Backoffice.User.UserSettings" %>

<%@ MasterType VirtualPath="~/Backoffice/BackOffice.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" AutoGenerateRows="False"
        DataSourceID="ObjectDataSource1" CellPadding="2" CellSpacing="2" FieldHeaderStyle-Width="350px">
        <Fields>
            <asp:TemplateField HeaderText="Default New Transaction:">
                <ItemTemplate>
                    <%# Eval("DefaultNewTransaction")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList runat="server" ID="ddlDefaultNewTransaction" SelectedValue='<%# Bind("DefaultNewTransaction") %>'
                        Width="165px">
                        <asp:ListItem Text="Stock" Value="Stock" />
                        <asp:ListItem Text="Option" Value="Option" />
                    </asp:DropDownList>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Default Reporting:">
                <ItemTemplate>
                    <%# Eval("DefaultReporting")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList runat="server" ID="ddlDefaultReporting" SelectedValue='<%# Bind("DefaultReporting") %>'
                        Width="165px">
                        <asp:ListItem Text="Transaction Listing" Value="Transaction Listing" />
                        <asp:ListItem Text="Stock Summary" Value="Stock Summary" />
                    </asp:DropDownList>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Date Format:">
                <ItemTemplate>
                    <%# Eval("DateFormatJS")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList runat="server" ID="ddlDateFormat" SelectedValue='<%# Bind("DateFormat") %>'
                        Width="165px">
                        <asp:ListItem Value="{0:MM/dd/yyyy}" Text="mm/dd/yy" />
                        <asp:ListItem Value="{0:dd/MM/yyyy}" Text="dd/mm/yy" />
                    </asp:DropDownList>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Thousands & Decimal Point Separator:">
                <ItemTemplate>
                    <%# Eval("ThousandsAndDecimalSeparator")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList runat="server" ID="ddlThousandsAndDecimalSeparator" SelectedValue='<%# Bind("ThousandsAndDecimalSeparator") %>'
                        Width="165px">
                        <asp:ListItem Value="{0:####.##}" Text="####.##" />
                        <asp:ListItem Value="{0:###,###.##}" Text="###,###.##" />
                        <asp:ListItem Value="{0:####.###}" Text="####.###" />
                        <asp:ListItem Value="{0:###,###.###}" Text="###,###.###" />
                    </asp:DropDownList>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowEditButton="true" ShowCancelButton="true" />
        </Fields>
    </asp:DetailsView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
    SelectMethod="GetUserSettings" TypeName="TreaShares.Backoffice.Controlers.UsersManager"
        OnUpdating="ObjectDataSource1_Updating" 
    UpdateMethod="UpdateUserSettings" onselecting="ObjectDataSource1_Selecting">
        <SelectParameters>
            <asp:Parameter Name="userId" Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="userId" Type="String" />
            <asp:Parameter Name="dateFormat" Type="String" />
            <asp:Parameter Name="dateFormatJS" Type="String" />
            <asp:Parameter Name="defaultNewTransaction" Type="String" />
            <asp:Parameter Name="defaultReporting" Type="String" />
            <asp:Parameter Name="thousandsAndDecimalSeparator" Type="String" />
        </UpdateParameters>
    </asp:ObjectDataSource>
</asp:Content>
